import { _decorator } from "cc";
import { CCInteger } from "cc";
import { lerp } from "cc";
import { ProgressBar } from "cc";
const { ccclass, property } = _decorator;

@ccclass('JProgressBar')
export default class JProgressBar extends ProgressBar{

    value:number = 0;
    nvalue:number = 0;

    @property({type:CCInteger,displayName:"动画速度"})
    scaleTime:number = 1;

    update(dt:number){
        //动画
        if(Math.abs(this.value - this.nvalue) < 0.001) this.nvalue = this.value;
        this.progress = (this.nvalue = lerp(this.nvalue,this.value,dt * this.scaleTime)) % 1;
        super.update(dt);
    }

}

